<!DOCTYPE html>
<html lang="en">
<%-include ../public/header.ejs%>

    <!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
    <!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
    <!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
    <!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
    <!--[if (gt IE 9)|!(IE)]><!-->

    <body class="">
        <!--<![endif]-->


        <%-include ../public/navbar.ejs%>

            <%-include ../public/aside.ejs%>



                <div class="content">

                    <div class="header">
                        <h1 class="page-title">管理员管理</h1>
                    </div>

                    <ul class="breadcrumb">
                        <li><a href="<%=host%>/admin/index">首页</a> <span class="divider">/</span></li>
                        <li class="active">管理员管理</li>
                    </ul>

                    <div class="container-fluid">
                        <div class="row-fluid">
                            <div class="btn-toolbar">
                                <a href="<%=host%>/admin/register/add" class="btn btn-primary"><i class="icon-plus"></i> 新增</a>
                                <div class="btn-group">
                                </div>
                            </div>
                            <div class="well">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th>头像</th>
                                            <th>用户名</th>
                                            <th>状态</th>
                                            <th>增加时间</th>
                                            <th>上一次登录的时间</th>
                                            <th style="width: 26px;"></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <%for(var i = 0;i<list.length;i++){%>
                                            <tr>
                                                <td>
                                                    <img src="<%=host%>/<%=list[i].img%>" width="40" height="40" />
                                                </td>
                                                <td>
                                                    <%=list[i].username%>
                                                </td>
                                                <td>
                                                    <%=list[i].status%>
                                                </td>
                                                <td>
                                                    <%=list[i].add_time%>
                                                </td>
                                                <td>
                                                    <%=list[i].last_login_time%>
                                                </td>
                                                <td>
                                                    <a href="<%=host%>/admin/register/edit/<%=list[i]._id%>"><i class="icon-pencil"></i></a>
                                                    <a href="<%=host%>/admin/register/delete/<%=list[i]._id%>"><i class="icon-remove"></i></a>
                                                </td>
                                            </tr>
                                            <%}%>
                                    </tbody>
                                </table>
                            </div>

                                 <ul class="pagination" id="pagination1"></ul>


                            <div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h3 id="myModalLabel">Delete Confirmation</h3>
                                </div>
                                <div class="modal-body">
                                    <p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to delete the user?</p>
                                </div>
                                <div class="modal-footer">
                                    <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
                                    <button class="btn btn-danger" data-dismiss="modal">Delete</button>
                                </div>
                            </div>

                            <footer>
                                <hr>

                                <!-- Purchase a site license to remove this link from the footer: http://www.portnine.com/bootstrap-themes -->
                                <p class="pull-right">A <a href="http://www.portnine.com/bootstrap-themes" target="_blank">Free Bootstrap Theme</a>                                    by <a href="http://www.portnine.com" target="_blank">Portnine</a></p>

                                <p>&copy; 2012 <a href="http://www.portnine.com" target="_blank">Portnine</a></p>
                            </footer>

                        </div>
                    </div>
                </div>


                <style>
                    .table th,.table td {
                        padding: 8px;
                        line-height: 40px;
                        text-align: center;
                        vertical-align: top;
                        border-top: 1px solid #dddddd;
                    }
                </style>
                <script src="<%=host%>/lib/bootstrap/js/bootstrap.js"></script>
        <script src="<%=host%>/public/javascripts/jqPaginator.js" type="text/javascript"></script>
                <script type="text/javascript">
                    $("[rel=tooltip]").tooltip();
                    $(function () {
                        $('.demo-cancel-click').click(function () { return false; });
                    });
                    $('#pagination1').jqPaginator({
                        totalPages: <%=totalPage%>,
                        visiblePages: 4,
                        currentPage: <%=page%>,
                        first: '<li class="first"><a href="javascript:;">第一页</a></li>',
                        prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',
                        next: '<li class="next"><a href="javascript:;">下一页</a></li>',
                        last: '<li class="last"><a href="javascript:;">最后一页</a></li>',
                        page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',

                        onPageChange: function (num, type) {

                            if(type=='change'){

                                location.href="<%=host%>/admin/register?page="+num;
                            }
                        }
                    });



                </script>

    </body>

</html>